Giter Club home page Giter Club logo

habitat's Introduction

Habitat

Habitat is a bunch of jumpyscript helpers that I use in my projects.

How to use it

Import from it.

<script type="module">
  import { print } from "./habitat.js";
  print("Hello world!");
</script>

If you want to embed it instead, just Ctrl+F and delete every export in the file. Then...

<script src="habitat.js"></script>
<script>
  print("Hello world!");
</script>

habitat's People

Contributors

magnogen avatar maxencedc avatar todepond avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

habitat's Issues

Simple development guide

Including basics of building the bundle Frogasaurus-style.
And where to put specific bits of code, eg: exports, globals, etc

Linked with #36

`tween` simplify

The tween function has lots of good functionality now. It has grown to be more complicated. Maybe we could try to simplify it down into smaller pieces. The one function does a few different things:

  • An extremely simple tween (using launch and land options)
  • Named eases from easings.net
  • Manually provided easing functions

Here's a wishlist I would have:

  • Can the easings.net functions be modifiable with the launch/land values too?
  • If the above checkbox is possible, then we could get rid of the basic 'launch' and 'land' ease, and just make one of the easings.net the default.
  • I wonder if the easings.net things could just be refined down to the ones that just ease in and out, so that the list is smaller. (as long as the above checkbox is possible).
  • I feel like all the in-built easings.net functions should be functions on the Tween object, like Tween.EASE_IN_CIRCULAR or something. Then the tween function would only do one thing: accept an ease function. No strings, or default launch/land behaviour.

Those are my loose + messy thoughts!

Trig helper functions

I hate trigonometry. I can't even spell it.

I want some helper functions that use non-maths language to help me out.

Principles Document?

There should be a rough guide for the principles/goals/style of the Habitat library, so that it is easier for people (including me) to contribute to the library!

`Object.prototype.map`

const scores = {english: 2, maths: 5, science: 3}

const results = scores.map((value) => value > 3? true : false)

print(results) // {english: false, maths: true, science: false}

Colours

Add the TodePond colours maybe? Or should it be in its own repo?

WAT

It would be great to have a function that turns webassembly text format into native code.

Redesign library to be more suitable for importing

eg: Array.prototype.shuffle() -> shuffleArray(array)

  • Array
  • Async
  • Colour
  • Console
  • Document
  • Event
  • Habitat
  • HTML
  • JavaScript
  • Keyboard
  • LinkedList
  • Math
  • Memo
  • Mouse
  • Number
  • Random
  • Stage
  • String
  • Struct
  • Touches
  • Tween

Optional new while we're at it:

  • Lerp
  • JSON
  • Pointer
  • Vector

Tween

Make a tween or animate function that lets you gradually change a variable's value over time.

let height = 10
tween(height, {from: 2, to: 8})

2D Linked List

I make this construct so often it would be good to make it

`struct`

const Player = struct ({
    name: undefined,
    score: 0,
    health: 10,
})

const lu = Player({name: "Lu", score: 5})

Linked List

A simple linked list maker would be handy.

Rehaul stage

Stage does too much in some ways. eg: I don't want it to have its own tick/draw/update functions! However, it does too little in other ways. eg: It doesn't auto-resize, and it doesn't have background colour, or overflow settings, or margin. It should be rewritten so that it focuses more on its HTML and less on its javascript.

JSX - HyperTode

Function that converts JSX to element(s)

And spoof a React object to hijack the default deno JSX factory

Colour helper functions

It would be great if there were some functions available for Colour objects that let you adjust brightness/saturation/etc...

Colour CMYK properties

Colour objects should have read-only cyan, magenta, yellow, and key properties. And maybe c,y,m,k properties too.

This issue comes from: #19

Touch error

An error appears when you touch the screen. Something's broken.

PropertyEditor is annoying

It messes with the global scope too much. I don't really use it ever anymore. Get rid of it?

It has a special place in my heart though because it's silly. Maybe I should move it (and other silly JS ideas) into their own esoteric project!

`memo`

Auto function memo-iser

clamp and wrap

It would be useful to have clamp and wrap functions as I end up remaking them a lot. Not sure if they should just be globals (bold move!?) or like... Math.clamp ?

`values()` consistency

Object.prototype.values() and similar functions should return an iterable, not an array, so that it has parity with how Map.prototype.values() etc works.

Pointer

Provide some global state for tracking pointer events, similar-ish to Mouse. Use the opportunity to reconsider Mouse and Touch/Touches because they're a bit clumsy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.