Splinetastic Face

Simple face constructor for kids using splines.
Splines from http://twolivesleft.com/Codea/Talk/discussion/282/splines#Item_3

http://alex812.posterous.com/splinetastic-face
Ok, picture http://db.tt/NGbujP6b

Wish it shows the screenshot. :frowning:

Awesome, @Alex812a. Looks like great fun. I think a really neat addition could be “morph targets.” Basically you could slide a parameter and move each node to different positions, then when you drag the parameter slider the face animates.

(Also embedded your screenshot here)

Splinetastic Face

How to refresh slider (test) in touched() function?

function setup()
iparameter(“test”,1,HEIGHT)
end

function touched()
if CurrentTouch.state ~= BEGAN then return end
test = CurrentTouch.y
print(test)
end

You can’t do that at the moment. Sliders are one way only - you change them and they change the variable, not the other way around.

I didn’t want a case where the user could “fight” with a slider. That is, the slider is changed every frame, and when you try to drag it, it does nothing.

This is how you can give them both control.
The slider always overides the touch.
But both can be used and displayed.


function setup()
    iparameter("sx",1,WIDTH,WIDTH/2) --slider x
    x = sx
    lsx = sx --last slider x
    watch("x")
end

function draw()
    rect(0,0,10,10)
    background(0, 0, 0)
    if lsx ~= sx then
        lsx = sx
        x = sx
    end
    ellipse(x,HEIGHT/2,100,100)
end

function touched(touch)
    x = touch.x
end 

You could actually have a slider that says “use slider” 0 or 1, or other logic that determined when the slider is in charge.

In a way, when you get to this point, you’ve “graduated” from sliders and should consider implementing your own sliders and converting to watch()es.

Code :-bd