This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Gary Jacobs
Posted Jun 11 - Read on Facebook

Hi,

I'm trying to fire the "Framer.resetDefaults()" function but not sure I have it in the right spot. I have it at the end

I want the function to fire off after the last animation has finished and reset the entire page. Any ideas?

Here is my code:

// Framer Settings
PSD = Framer.Importer.load("imported/xbet")

// Settings

PSD["counter"].visible = false
PSD.counter.x = -32
PSD["circleCheck"].visible = false
PSD["circleCheck"].scale = 0.5
PSD["pressOff"].visible = false
PSD["pressOn"].visible = true
PSD["pressOff"].opacity = 0
PSD["pressOn"].opacity = 0

// Defining animation curves

anticipate = "spring(2000,30,20)"
release = "spring(1000,35,50)"
releaseTwo = "spring(10,35,500)"
slideIn = "spring(100,20,10)"
slideOver = "spring(100,20,10)"
slideOut = "spring(100,20,10)"
slideBack = "spring(100,20,10)"

// Animation functions

selectingStart = function () {
PSD["unchecked"].animate({properties:{scale:0.9}, curve: anticipate })
};

selectingEnd = function () {
PSD["unchecked"].visible = false
PSD["counter"].visible = true
PSD["pressOn"].visible = false
PSD["pressOff"].visible = true
PSD["circleCheck"].visible = true
PSD["circleCheck"].animate({properties:{scale:1}, curve: release })
PSD["title"].animate({properties:{x:32+30}, curve: slideOver })
PSD["counter"].animate({properties:{x:-10}, curve: slideIn })
};

deselectingEnd = function () {
PSD["unchecked"].visible = true
PSD["pressOn"].visible = true
PSD["pressOff"].visible = false
PSD["tick"].animate({properties:{x:22, y:60, rotationZ:36, opacity:0}, curve: "ease-in-out", time: 0.200})
PSD["circle"].animate({properties:{opacity:0}, curve: "ease-in-out", time: 0.100})
PSD["title"].animate({properties:{x:32}, curve: slideBack })
PSD["counter"].animate({properties:{x:-44}, curve: slideOut })
};

// Tap Functions

PSD.pressOn.on(Events.TouchStart, function() {
selectingStart();
})

PSD.pressOn.on(Events.TouchEnd, function() {
selectingEnd();
})

PSD.pressOff.on(Events.TouchEnd, function() {
deselectingEnd();
utils.delay (0.400, Framer.resetDefaults());

})

2 Comments

Koen Bok

First off, if you use it like this you want:

utils.delay (0.400, Framer.resetDefaults);

(only pass the reference)

But I think you are looking for something else, because this is just to reset the defaults (like backgroundColor for Layer) to the original values.

Gary Jacobs

Yeah, you're right. It worked but not for what I need it for. I'll keep tinkering. As always, thank you.

Read the entire post on Facebook