Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with Checkbox expression transforming position of Layer

New Here ,
Sep 28, 2021 Sep 28, 2021

Hi I need some help with this expression, I keep getting an error saying expression must be a result of dimension 2 not 1.

 

This is the current expression

 

x = transform.position[1];// current location of object x axis

y = transform.position[1];// current location of object in y axis

x1 = 1 ;

Y1 = 1 ;

cb = effect("1-1")("Checkbox") ;

if (cb ==1) {

{x1,Y1};

} else {[x,y];}

TOPICS
Expressions
114
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 28, 2021 Sep 28, 2021
LATEST

You have defined both x and y as the y value of position in the first two lines. 

 

The if statement has x1 and Y1 in {} and they should be in [];

 

If I wanted the checkbox to move the layer from its current X, Y position to 1, 1 this is how I would write it.

 

 

cb = effect("1-1")("Checkbox");
if (cb == 1) {
    [1, 1];
} 
else {
    position;
}

 

 

If you want to define variables for everything I would write it like this:

 

 

pos = position;
x1 = 1 ;
y1 = 1 ;
cb = effect("1-1")("Checkbox");
if (cb == 1) {
     [x1, y1];
} 
else{
     position;
}

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines