Skip to main content

curve-eval

Evaluate .curve.json animation curves authored in the Curve Editor VS Code extension. Supports bezier, linear, and constant interpolation for float, int, vec2/3/4, and color types.

Zero dependencies (standard library only). Python 3.9+. Full type hints.

Install

pip install curve-eval

Usage

from curve_eval import evaluate, evaluate_all, evaluate_state
import json

with open('anim.curve.json') as f:
    file = json.load(f)

# Absolute time
opacity = evaluate(file, 'fadeIn', 2.5)              # → 0.72
color   = evaluate(file, 'tint', 1.0)                # → {'r': 1.0, 'g': 0.5, 'b': 0.0, 'a': 1.0}
position = evaluate(file, 'position', 0.5)           # → (5.0, 2.5, 1.0)

# Normalized time (0–1 maps to the curve's full time range)
mid = evaluate(file, 'fadeIn', 0.5, normalized=True)

# State curves return index + optional label
light = evaluate_state(file, 'trafficLight', 6.0)    # → {'index': 1, 'label': 'Yellow'}

# Evaluate every curve at one time
frame = evaluate_all(file, 3.0)
# → {'fadeIn': 0.92, 'scaleX': 1.5, 'trafficLight': 2, 'tint': {'r': 1, ...}}

API

Function Returns
evaluate(file, name, time, *, normalized=False) float / int / tuple / dict
evaluate_all(file, time, *, normalized=False) dict[str, value]
evaluate_state(file, name, time, *, normalized=False) {"index": int, "label": str | None}
get_curve_names(file) list[str]
get_curve_time_range(file, name) {"start": float, "end": float} | None

Interpolation Modes

  • constant — value holds at the left key until the next key is reached
  • linear — straight-line interpolation between keys
  • bezier — cubic bezier with per-key tangent handles (Newton-Raphson solver)

Per-component interpolation is supported on vec/color curves: each component (X/Y/Z or R/G/B/A) can use a different mode on the same keyframe.

Infinity Modes (extrapolation)

Each curve has preInfinity and postInfinity modes that control behavior outside the authored key range:

  • constant — hold the endpoint value
  • linear — extrapolate with the endpoint's tangent slope
  • cycle — loop the authored range
  • oscillate — ping-pong the authored range

License

MIT © Glen Rhodes / Tiny Moosh Games Inc.

Source: https://github.com/glenwrhodes/CurveEditor

Metadata

Release files for curve-eval 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for curve-eval 1.0.0
File Size Uploaded
curve_eval-1.0.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for curve-eval 1.0.0
File Interpreter ABI Platform
curve_eval-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / curve_eval-1.0.0.tar.gz

Download URL curve_eval-1.0.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a2eb99dc5d815578a01fc9e9e7f92bd0a676b726eb8b94d77533f3244d992d9f
BLAKE2b-256 checksum
How to use checksums
2341ba839c29384181ec217f6029cadd78046a3ab067f20d9a5bf4aba7253ccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / curve_eval-1.0.0-py3-none-any.whl

Download URL curve_eval-1.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef3a9fa386855d38158fcc759886879028000075b945105a149b421abbe38d6e
BLAKE2b-256 checksum
How to use checksums
5c7544b9b7182fd40685c17b64cba2290f3f9f1c54e77e559c383c1a8fb9dc7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page