Skip to content

feat: added opacity and blur#143

Closed
zuraHQ wants to merge 1 commit into
OpenCut-app:mainfrom
zuraHQ:scale
Closed

feat: added opacity and blur#143
zuraHQ wants to merge 1 commit into
OpenCut-app:mainfrom
zuraHQ:scale

Conversation

@zuraHQ
Copy link
Copy Markdown

@zuraHQ zuraHQ commented Jun 27, 2025

Description

added blur and opacity feature
Implemented CSS-based live preview for instant visual feedback
Added FFmpeg functions for high-quality blur and opacity processing during export

Fixes # (issue)

Type of change

  • [] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Manual Testing Performed:

Video Preview

Test Configuration:

  • Node version:
  • Browser (if applicable):
  • Operating System:

Screenshots (if applicable)

Add screenshots to help explain your changes.

Checklist:

  • [] My code follows the style guidelines of this project
  • [] I have performed a self-review of my code
  • [] I have commented my code, particularly in hard-to-understand areas
  • [] My changes generate no new warnings

Additional context

Add any other context about the pull request here.

Summary by CodeRabbit

  • New Features

    • Re-enabled the Properties Panel in the editor, making it visible and interactive.
    • Added interactive sliders in the Properties Panel to adjust blur and opacity effects for selected clips.
    • Applied real-time blur and opacity visual effects to clips in the preview panel.
    • Introduced support for managing clip effects, including updating, removing, and clearing effects.
  • Enhancements

    • Added backend processing for blur and opacity effects to video clips.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 27, 2025

👷 Deploy request for appcut pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 974963b

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 27, 2025

Walkthrough

This change introduces a new clip effects system to the editor, enabling blur and opacity adjustments per clip. It adds a Zustand effects store, updates the properties panel for interactive effect controls, applies effects in the preview panel, and implements FFmpeg utilities to process blur and opacity on video files. The properties panel is also re-enabled in the editor layout.

Changes

File(s) Change Summary
apps/web/src/stores/effects-store.ts Added Zustand store for managing per-clip visual effects (blur, opacity) with update, get, remove, and clear methods.
apps/web/src/components/editor/properties-panel.tsx Enhanced to provide interactive blur and opacity sliders tied to selected clip via the new effects store.
apps/web/src/components/editor/preview-panel.tsx Updated to retrieve and apply clip-specific blur and opacity effects from the effects store during rendering.
apps/web/src/lib/ffmpeg-utils.ts Added applyBlurEffect and applyOpacityEffect functions to process video files with blur and opacity using FFmpeg.
apps/web/src/app/editor/page.tsx Re-enabled the PropertiesPanel in the editor layout, making it visible and interactive.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PropertiesPanel
    participant useEffectsStore
    participant PreviewPanel

    User->>PropertiesPanel: Adjusts blur/opacity sliders
    PropertiesPanel->>useEffectsStore: updateClipEffect(trackId, clipId, effectType, value)
    useEffectsStore-->>PropertiesPanel: Updates state

    PropertiesPanel-->>PreviewPanel: Effects state changes
    PreviewPanel->>useEffectsStore: getClipEffects(trackId, clipId)
    useEffectsStore-->>PreviewPanel: Returns effect values
    PreviewPanel-->>User: Renders clip with updated blur/opacity
Loading

Possibly related PRs

Poem

A bunny hops with glee today,
For clips can now be blurred away!
Opacity slides, effects galore,
Each edit brings a little more.
With panels bright and sliders new,
The editor's magic shines right through!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdfb5ea and 974963b.

📒 Files selected for processing (5)
  • apps/web/src/app/editor/page.tsx (2 hunks)
  • apps/web/src/components/editor/preview-panel.tsx (6 hunks)
  • apps/web/src/components/editor/properties-panel.tsx (3 hunks)
  • apps/web/src/lib/ffmpeg-utils.ts (1 hunks)
  • apps/web/src/stores/effects-store.ts (1 hunks)
🔇 Additional comments (15)
apps/web/src/lib/ffmpeg-utils.ts (2)

233-267: LGTM! Well-implemented blur effect function.

The applyBlurEffect function follows the established pattern and correctly implements the blur effect using FFmpeg's gblur filter. The sigma calculation is appropriate and the audio preservation is properly handled.


269-308: LGTM! Proper opacity effect implementation.

The applyOpacityEffect function is well-implemented with correct alpha channel handling. The opacity conversion from percentage to normalized value is accurate, and the FFmpeg filter chain properly applies the opacity effect while preserving audio.

apps/web/src/stores/effects-store.ts (3)

4-7: LGTM! Clean interface definition for effect values.

The EffectValues interface is well-defined with appropriate data types for blur and opacity effects.


10-14: LGTM! Well-structured clip effects interface.

The ClipEffects interface properly associates clips with their tracks and effect values, providing a clear data structure for the effects system.


38-90: LGTM! Excellent Zustand store implementation.

The store implementation is well-designed with:

  • Proper immutable state updates
  • Clean CRUD operations
  • Appropriate default value handling
  • Consistent API patterns

The updateClipEffect function correctly handles both updating existing effects and creating new ones with default values.

apps/web/src/app/editor/page.tsx (2)

11-11: LGTM! PropertiesPanel import correctly restored.

The import statement for PropertiesPanel has been properly uncommented to enable the properties panel functionality.


85-93: LGTM! PropertiesPanel component properly re-enabled.

The ResizablePanel containing the PropertiesPanel has been correctly uncommented, making the properties panel available in the editor layout. The panel configuration with size constraints and resize handling is appropriate.

apps/web/src/components/editor/preview-panel.tsx (4)

10-10: LGTM! Effects store integration properly imported.

The useEffectsStore import is correctly added to enable effects functionality in the preview panel.


26-26: LGTM! Effects store hook properly utilized.

The getClipEffects function is correctly extracted from the effects store hook for use in the component.


123-131: LGTM! Clean effects retrieval and style application.

The implementation correctly:

  • Destructures track information from clipData
  • Retrieves effects for the specific clip and track
  • Creates appropriate CSS filter and opacity styles
  • Applies effects consistently across all clip types

138-138: LGTM! Consistent effects application across all clip types.

The filterStyle is properly applied to all clip rendering paths (test clips, video clips, image clips, and audio clips), ensuring consistent visual effects regardless of media type.

Also applies to: 151-151, 167-167, 184-184

apps/web/src/components/editor/properties-panel.tsx (4)

17-17: LGTM! Effects store properly imported.

The useEffectsStore import is correctly added to enable effects management in the properties panel.


24-24: LGTM! Store hooks properly destructured.

The component correctly extracts selectedClips from the timeline store and updateClipEffect/getClipEffects from the effects store.

Also applies to: 26-26


53-66: LGTM! Robust selected clip handling.

The implementation properly:

  • Gets the first selected clip from the selection
  • Finds the corresponding track
  • Retrieves the clip data from the track
  • Gets current effects with appropriate fallback defaults
  • Handles cases where no clip is selected

179-222: LGTM! Excellent dynamic effects controls implementation.

The effects section properly:

  • Conditionally renders based on clip selection
  • Displays current effect values in labels
  • Binds sliders to store actions with proper parameters
  • Provides clear user feedback when no clip is selected
  • Uses appropriate ranges and steps for both opacity (0-100%) and blur (0-20px)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@izadoesdev
Copy link
Copy Markdown
Collaborator

update and merge into staging

@izadoesdev izadoesdev closed this Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants