zoukankan      html  css  js  c++  java
  • MAXScript笔记_Function函数

    语法:
    function <函数名> <参数1> <参数2>=(expr)

    实例1:

    function createSphere count growth =
    (
    for i in 1 to count do
    sphere radius:(i*growth) pos:[i^2*growth,0,0] 
    )

     函数的调用:

    createSphere 5 10

     实例2:有返回参数

    function cellMaterial baseColor cellSize = 
    (
    local mtl = standardMaterial specularLevel:55 glossiness:35,
    map = cellular cellColor:baseColor size:cellSize fractal:on
    mtl.diffuseMap = map
    return mtl --返回该材质
    )
    $Sphere01.material = cellMaterial red 25
    $Sphere02.material = cellMaterial blue 50
    $Sphere03.material = cellMaterial red 25
    $Sphere04.material = cellMaterial blue 5

    该材质函数具有返回值,因此在函数调用时可以做右值赋予某一个变量

  • 相关阅读:
    【转】linux常用命令
    【转】C++三大特性
    插入排序
    shixi
    【转】TCP协议
    【转】排序算法稳定性
    面筋BD
    斐波那契数列
    【面试题】D
    【学习笔记】OI模板整理
  • 原文地址:https://www.cnblogs.com/amixc/p/3992915.html
Copyright © 2011-2022 走看看