This file contains 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
// Define a trait function to that expects behavior to convert a value to type T | |
trait fun to<T>(): T | |
// So you want to require a property? Use a trait getter! | |
trait fun(get) displayName: String | |
// You can define a tuple type with parenthesis | |
tuple Name (String, String) { | |
|(first, last)| impl fun to<String>() = "${first} ${last}" | |
This file contains 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
const stackCount = 10 | |
const STACK_SPACE = 10; | |
// Draw the stack of images | |
for (let i = 0; i < stackCount; i++) { | |
const shearFactor = (stackCount - i) | |
// Calculate scale and position adjustments based on the current iteration | |
const scaleAdjustment = 0.9 + (0.1 * (i - shearFactor)) / stackCount | |
const positionAdjustmentX = (scaledImageWidth - (scaledImageWidth * scaleAdjustment)) / 2; | |
const positionAdjustmentY = (STACK_SPACE * shearFactor); |
OlderNewer