패키지, 저장소 및 앱 카테고리 검색

metaballs 표지
패키지 상세v1.5.0

metaballs

웹에서는 WebGL을 사용하고, 다른 장치에서는 shader 패키지를 사용하는 Flutter용 메타볼 구현

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
175
좋아요
100
Pub 점수
150

패키지 설치

flutter pub add metaballs

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Metaballs는 웹에서는 WebGL을 사용하고 네이티브 플랫폼에서는 shader 패키지를 사용하여 유체적이고 동적인 메타볼 효과를 생성하는 Flutter 패키지입니다. 사용자 입력이나 애니메이션에 반응하는 유기적이고 융합되는 형태로 부드럽고 인터랙티브한 시각화를 가능하게 합니다. 배경 애니메이션, 추상적 인터페이스 및 몰입형 UI에 적합하며, Android, iOS, Web, macOS, Windows, Linux에서 고성능을 위해 GPU 가속을 활용합니다. 복잡한 셰이더 로직을 사용하기 쉬운 API로 단순화하여 그래픽 지식이 깊지 않은 개발자도 고급 시각 효과를 쉽게 이용할 수 있도록 합니다.

사용 사례

  • 인터랙티브 앱 배경
  • 애니메이션 스플래시 화면
  • 추상 UI 요소
  • 데이터 또는 음악을 위한 시각화 도구
  • 동적 그라디언트 오버레이

주요 기능

  • 웹 기반 WebGL 렌더링
  • 네이티브 기반의 쉐이더 구현
  • 부드럽고 반응성이 뛰어난 메타볼 물리
  • 크로스 플랫폼 호환성
  • 복잡한 시각 효과를 위한 간단한 API
  • GPU 가속 성능

적합한 대상

  • 유연한 애니메이션을 찾는 UI 디자이너
  • 몰입형 경험을 구축하는 개발자
  • 예술적 또는 추상적인 주제를 가진 앱
  • 실시간 시각 피드백이 필요한 프로젝트
  • 인터랙티브 배경 프로토타이핑

고려 사항

  • 모바일 장치에서의 높은 GPU 사용률
  • 개별 공 속성에 대한 사용자 정의가 제한적
  • 기본적인 쉐이더 개념에 대한 이해가 필요합니다
  • 정적 또는 간단한 UI에 적합하지 않음
  • 오래된 기기에서는 성능이 다를 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Animated Metaballs for Flutter

Pub Version Live Example

About

This library makes it easy to add well performing, highly configurable metaballs to your flutter project. The metaballs automatically scale to any screen size so you don't have to manually adjust the parameters for different devices. The metaballs have been implemented in shaders for the best performance across all devices. All available effects have been optimized for both mouse and touch input and should not interfere with any gesture detectors


Installing:

dependencies:
  metaballs: ^1.4.2
import 'package:metaballs/metaballs.dart';

Usage:

Metaballs(
  color: const Color.fromARGB(255, 66, 133, 244),
  effect: MetaballsEffect.follow(
    growthFactor: 1,
    smoothing: 1,
    radius: 0.5,
  ),
  gradient: LinearGradient(
    colors: [
      const Color.fromARGB(255, 90, 60, 255),
      const Color.fromARGB(255, 120, 255, 255),
    ],
    begin: Alignment.bottomRight,
    end: Alignment.topLeft
  ),
  metaballs: 40,
  animationDuration: const Duration(milliseconds: 200),
  speedMultiplier: 1,
  bounceStiffness: 3,
  minBallRadius: 15,
  maxBallRadius: 40,
  glowRadius: 0.7,
  glowIntensity: 0.6,
  child: Text('METABALLS')
)

Property Default value Accepted values Description
Color? color Color(0xff4285F4) The color of the metaballs
MetaballsEffect? effect The animated effect applied to the metaballs
Gradient? gradient A gradient for coloring the metaballs, overwrites color
int? metaballs 40 1 to 128 The amount of metaballs
Duration? animationDuration Duration(milliseconds: 200) The duration of the color changing animation
double? speedMultiplier 1 Above 0 A multiplier of the ball movement speed
double? bounceStiffness 3 Above 0 A multiplier to change the speed at which balls change direction
double? minBallRadius 15 0 or more The minimum size of a ball
double? maxBallRadius 40 Above min The maximum size of a ball
double? glowRadius 0.7 0 to 1 A multiplier to indicate the radius of the glow
double? glowIntensity 0.6 0 to 1 The brightness of the glow around the ball
Widget? child A widget to be placed on top of the Metaballs widget

Effects


MetaballsEffect.follow()

This effect adds a metaball for every cursor / touch and then follows that cursor / touch around

Property Default value Accepted values Description
double? smoothing 1 0 or more The amount the metaballs movement gets smoothed
double? growthFactor 1 0 or more The amount the metaballs grow relative to their movement speed
double? radius 0 or more The size of the following metaball where 0 is the minBallRadius and 1 is the maxBallRadius


MetaballsEffect.speedup()

This effect makes all metaballs speedup relative to how fast you move your mouse or swipe on your touchscreen

Property Default value Accepted values Description
double? speedup 1 Above 0 The amount the metaballs speed up relative to the mouse / swipe speed


MetaballsEffect.grow()

This effect increases the radius of all metaballs based on how close they are to the mouse cursor or a touch

Property Default value Accepted values Description
double? radius 0.5 Above 0 The radius around the mouse / touch in which the metaballs get scaled up
double? growthFactor 0.5 Above 0 The amount by which the metaballs increase in size
double? smoothing 1 0 or more The amount the movement gets smoothed


MetaballsEffect.ripple()

This effect makes all metaballs increase and then decrease their radius in an outgoing ripple from a tab / mouse click

Property Default value Accepted values Description
double? speed 1 Above 0 The speed of the ripple effect
double? width 1 Above 0 The the ripple width
double? growthFactor 1 Above 0 The amount by which the metaballs grow
Duration? fade Duration(milliseconds: 1200) The time before the ripple is completely faded away


Web support

On web the gradients are currently manually implemented in webgl because ShaderMask is currently not supported on web. Because of that certain gradient features are currently not implemented like the focal and focalRadius options on the RadialGradient and the transform matrix on all gradients. Support for these options will probably be added in a later release but currently don't have high priority. If you depend on these features feel free to open a feature request or pull request on github.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.