Shagen Ogandzhanian
3 years ago
2 changed files with 43 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. |
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.jetbrains.compose.web.css |
||||||
|
|
||||||
|
|
||||||
|
fun interface TransformFunction { |
||||||
|
fun apply(): String |
||||||
|
} |
||||||
|
|
||||||
|
fun matrixTransform(a: Number, b: Number, c: Number, d: Number, tx: Number, ty: Number) |
||||||
|
= TransformFunction { "matrix($a, $b, $c, $d, $tx, $ty)" } |
||||||
|
|
||||||
|
|
||||||
|
fun StyleBuilder.transform(transformFunction: TransformFunction) { |
||||||
|
property("transform", transformFunction.apply()) |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
/* |
||||||
|
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. |
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. |
||||||
|
*/ |
||||||
|
|
||||||
|
package org.jetbrains.compose.web.core.tests.css |
||||||
|
|
||||||
|
import org.jetbrains.compose.web.core.tests.runTest |
||||||
|
import org.jetbrains.compose.web.css.matrixTransform |
||||||
|
import org.jetbrains.compose.web.css.transform |
||||||
|
import org.jetbrains.compose.web.dom.Div |
||||||
|
import kotlin.test.Test |
||||||
|
import kotlin.test.assertEquals |
||||||
|
|
||||||
|
class TransitionTests { |
||||||
|
@Test |
||||||
|
fun matrix() = runTest { |
||||||
|
composition { |
||||||
|
Div({style { transform(matrixTransform(1, 2, -1, 1, 80, 80)) }}) |
||||||
|
} |
||||||
|
|
||||||
|
assertEquals("matrix(1, 2, -1, 1, 80, 80)", nextChild().style.transform) |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue