• 100 Posts
  • 346 Comments
Joined 3 months ago
cake
Cake day: July 15th, 2024

help-circle















  • Perchance is built on JS. Code blocks are [JavaScript expressions]. Functions just have fn() => JavaScript code in them. Plus, you could just put a script tag in the HTML of the page and put JS direct in there if you wanted to. So yeah, you can do loops as usual. 👍

    This also means you can call something like the image generator with just a simple js object, normal strings, and so on. Which can make things a lot easier and encapsulated.

    Personally, I’d write the image function as not changing values, and just creating the needed HTML and returning that. But you can do things however you want to.

    I’m not sure I fully understood, but I got the jist ;p

    To generate a random value from a list, access it with .selectOne to get a random item, or .evaluateItem to get a finalised string value. And store that in a variable. So like row_animal = animals.evaluateItem. Then use that in the prompt you send to the image generator function. If you want that to change between rows, after a row ends just run that code again to grab a new random item.




  • I don’t see the code blending_value = [blending_values.selectAll[counter]] in there at all.

    next_matrix_image() is very hard to read… you can use if and else statements so it’s easier to understand (and code, I’d say).

    …None of which really matters to your question. I’m just finding it very difficult to even understand what your code is doing or trying to do. 🫠

    Is the problem that it changes animal? Looks to me like it’s not changing animal. It always renders horses for me. Is that what you wanted, or didn’t want? What do you actually want to happen? I’m so confused… 😅