Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate constraint relative to element #6

Closed
theposch opened this issue Jun 17, 2016 · 1 comment
Closed

Animate constraint relative to element #6

theposch opened this issue Jun 17, 2016 · 1 comment

Comments

@theposch
Copy link

theposch commented Jun 17, 2016

Is there a way to set the constraint like this when animating a constraint?

topLayer.constraints.leading = [myLayer,16]

This is what i'm trying to do:

cardText.constraints =
        top: [title, 16]
        leading: 16
        trailing: 16



if setup.image

    thumbnail = new Layer
         superLayer: card
         image: setup.image
         height: setup.imageHeight

    thumbnail.constraints =
             leading:0
         trailing:0
         top: [title, 24]

#   cardText.constraints.top = thumbnail, 16
@k-vyn
Copy link
Owner

k-vyn commented Jun 18, 2016

Yeah, you definitely can. If you've already set constraints on that layer before, you can do the syntax just like that. If you haven't, you need to one extra step:

topLayer.constraints = {}
topLayer.constraints.leading = [myLayer, 16]

The compiler just needs to know that it's an object before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants