new refer(getFunc, setFunc= null)
類似pointer,每呼叫一次refer就會呼叫其getFunc/setFunc 以 取值/設值
property - val 此refer的實際數值
val
let celsius = new pointer(30); // 直接 = 30 也可以 let fahrenheit = new refer( function () { return (celsius * 9) / 5 + 32; }, function (value) { celsius = ((value - 32) * 5) / 9; } ); print(celsius); // 30 print(fahrenheit); // 86 fahrenheit.val = 212 print(celsius); // 100 print(fahrenheit); // 212
若無setFunc,則fahrenheit.val = 212不會起作用
fahrenheit.val = 212
可以搭配動畫物件的排版使用 (範例可洽(還沒放上來))
There was an error while loading. Please reload this page.