When I try to run the example, I found that it can not run.
The error info is:
Error: [string "-- tween.lua ..."]: 133: attempt to perform arithmetic on local 'v' (a userdata value)
I tried the example on my two devices iPad with iOS8, mini with iOS7, the same problem.
If anyone found it before?
Here is the test code, copy from online help
-- TestProj
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
box = { x = 10, y = 10, width = 20, height = 20,fillColor = color(255) }
-- tween(1, box, {x = 100, y = 100})
tween(1, box, {fillColor = color(255,0,0)})
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
rect(box.x,box.y,box.width,box.height)
-- Do your drawing here
end
Only numbers can be tweened, not ‘userdata values’ such as colors. Therefore, you would have to tween the red, green, blue, and alpha values separately (in the target table).
@Saturn031000 If the example code can not run, I think the online example should be modified, otherwise, beginners like me are very easy to be confused with the example. @Simeon
@Jordan When I add the ‘mt’ code , it is ok. It seems that you have showed a new way to change the Codea`s behavior from inside! Very good!
@dave1707 I am reading the tutorial “Codae for beginners” written by @Ignatz ,
and try all examples in it, my code is from here:
The tutorial is a good ebook, help me to understand the function tween() clearly. When I read the online help, the code is too simple to run; when I read the example project, it is so complex(mess the class,table together) and it is not good for beginners to understand the usage of tween().
@binaryblues Why that example is written like that will have to be answered by @Ignatz. I took your code above and tried to run it and got the same error. The fill command is used for color, so that’s what I tried and it worked.
@dave1707 What my meaning is that the online help document code has some errors, and it maybe confuse the beginners, so we should correct it. It is a manual bug.
@Ignatz thanks for your tutorial! It is nice for beginners.