Function | Description |
---|---|
f = dot(v, v) |
Vector dot product |
v = cross(v, v) |
Vector cross product |
m = matrixCompMult(m, m) |
Component-wise multiply |
Construct | Syntax / Notes |
---|---|
Function Call | Call by value-return |
Iteration | for (<init>; <test>; <next>) { break, continue } |
Selection | if () { } if () { } else { } switch () { break, case } (default case should be last) |
Jump | break, continue, return ( discard is not allowed) |
Entry Point | half4 main(float2 fragCoord) |
Function | Description |
---|---|
vec4 unpremul(vec4 color) |
Converts color value to non-premultiplied alpha |
half3 toLinearSrgb(half3 color) |
Color space transformation to linear SRGB |
half3 fromLinearSrgb(half3 color) |
Color space transformation from linear SRGB |
Operator | Description | Associativity |
---|---|---|
() |
Parenthetical Grouping | N/A |
[] () . ++ -- (postfix) |
Array subscript, Function call & constructor, Structure field or method selector, Swizzle, Postfix increment and decrement | Left to Right |
++ -- + - ! (prefix) |
Prefix increment and decrement, Unary plus, Unary minus, Logical NOT | Right to Left |
* / |
Multiply, Divide | Left to Right |
+ - (binary) |
Addition, Subtraction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun AnimatedTextTextField( | |
value: String, | |
onValueChange: (String) -> Unit, | |
modifier: Modifier = Modifier, | |
textStyle: TextStyle = TextStyle(fontSize = 50.sp) | |
) { | |
val scope = rememberCoroutineScope() | |
val animatables = remember { mutableStateMapOf<Int, Animatable<Float, AnimationVector1D>>() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@OptIn(ExperimentalLayoutApi::class) | |
@Composable | |
fun AnimateCharTextField( | |
value: String, | |
onValueChange: (String) -> Unit, | |
modifier: Modifier = Modifier, | |
textStyle: TextStyle = TextStyle(fontSize = 50.sp) | |
) { | |
val scope = rememberCoroutineScope() | |
val animatables = remember { mutableStateMapOf<Int, Animatable<Float, AnimationVector1D>>() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val lifecycleOwner = LocalLifecycleOwner.current | |
DisposableEffect(lifecycleOwner) { | |
val lifecycleEventObserver = LifecycleEventObserver { lifecycleOwner, event -> | |
when (event) { | |
Lifecycle.Event.ON_CREATE -> Log.d("compose lifecycle", event.name) | |
Lifecycle.Event.ON_START -> Log.d("compose lifecycle", event.name) | |
Lifecycle.Event. ON_RESUME -> Log.d("compose lifecycle", event.name) | |
Lifecycle.Event.ON_PAUSE -> Log.d("compose lifecycle", event.name) | |
Lifecycle.Event.ON_STOP -> Log.d("compose lifecycle", event.name) | |
Lifecycle.Event.ON_DESTROY -> Log.d("compose lifecycle", event.name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/widget.dart'; | |
import 'package:flutter/materail.dart'; | |
import 'package:flutter/cupertnio.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { |